#include <bits/stdc++.h>
using namespace std;

const int maxn = 1e5 + 5;
int s[maxn], idx[maxn];

int main()
{
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    ios::sync_with_stdio(0);
    int n, ans;
    scanf("%d", &n);
    ans = n;
    for(int i = 1;i <= n;i++)  scanf("%d", &s[i]);
    sort(s + 1, s + n + 1);
    for(int i = 1;i <= n;i++)
    {
        if(idx[s[i]] != 0)  continue;
        idx[s[i]] = (upper_bound(s + 1, s + n + 1, s[i]) - s);
    }
    for(int i = 1;i <= n;i++)
    {
        if(idx[s[i]] > n || idx[s[i]] == -1)  break;
        idx[s[i]]++;
        ans--;
    }
    cout<<ans;
    return 0;
}
